A framework must be started before any services can be provided in a network. There exist various techniques for starting a framework. According to one such technique, a framework can be started by some command line initiation or by reading startup information from a configuration file. Some events that take place when a framework is started are, handling of events, entering of system bundle in starting state, staring previously stalled bundles, wrapping up an exception that occur during startup, publishing the exception, entering of the system bundle in a start state, and broadcasting a framework event that indicates the framework has started.
There are occasions when a framework needs to be shutdown. Shutdown of a framework can be initiated by stopping the system bundle or a framework can get shutdown abruptly due to some dependency failure. Some examples of dependency failure include power shutdown and battery null. Some events that take place when a framework is shutdown are, entering of system bundle in a stopping state, stopping all active bundles, recording sates of all the active bundles at the shutdown, wrapping exception, publishing the exceptions, and disabling event handling. When a framework is shutdown, a start-level of the framework is decremented to zero. A start-level of zero is a state in which the framework has either not been launched or has completed shutdown (these two states are considered to be equivalent). In this state, no bundles are running. The requested start-level must be set to zero when the Framework shuts down.
For each start-level, the framework implementation can select an appropriate ordering for stopping of bundles in the start-level. This may include stopping bundles in reverse dependency order such that all bundles which depend on a given bundle are shutdown before the given bundle. At any point of time when a framework shuts down, all controllers that are using the framework needs to be informed about the shutdown.
In light of the above discussion, there is a need for handling shutdown of a framework in a network that informs all the controllers that are using the framework about the shutdown of the framework.